<template>
	<view class="flex agreement-box">
		<view class="mar-right-12 icon-box centerXY" @click="hanldeCheckbox">
			<u-icon v-if="checkbox" size="16" color="#FC6BB0" name="checkbox-mark"></u-icon>
		</view>
		<view class="font-24 color-grey">
			同意并接受<text @click="hanldeAgreement('user_agreement','用户隐私协议')">《用户隐私协议》</text> 和 <text
				@click="hanldeAgreement('terms_use','服务协议')">《服务协议》</text>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			checkbox: {
				type: Boolean,
				default: false
			}
		},
		data() {
			return {

			}
		},
		methods: {
			// 跳转协议页面
			hanldeAgreement(code, text) {
				uni.navigateTo({
					url: '/pages/agreement/agreement?code=' + code + '&text=' + text
				})
			},
			// 改变状态
			hanldeCheckbox() {
				this.$emit('hanldeCheckbox')
			},
		}
	}
</script>

<style scoped lang="scss">
	@import "@/uni.scss";

	text {
		color: $uni-white;
	}

	.icon-box {
		width: 30rpx;
		flex-shrink: 0;
		height: 30rpx;
		border: 1rpx solid #f5f5f5;
		border-radius: 50%;
	}
</style>